function _dictionary(string,array,seps0,seps1,totsp,__varend__,sp1,sp2,i)
{
	expr=seps0"+" ; gsub(expr,seps0,string)
	expr=seps0"+$"; gsub(expr,"",string)
	totsp=split(string,sp1,seps0)
	for(i in sp1) 
	{  
		split(sp1[i],sp2,seps1)
		array[sp2[1]]=sp2[2]
	} 
	return totsp	
}

function _max(a,b)
{
	if (a<=b){a=b}	    
	return a
}

function _printarray(array,array_name,__varend__,i,str)
{    
	for(i in array)
	{str=sprintf("%s[+:%3s:-] = %s",array_name,i,array[i]); _message("d",str)}
}

function _Nsumarray(array,__varend__,sum,i)
{
	for (i in array)
		sum+=array[i]
	return sum
}

function _Ssumarray(array,sep,__varend__,sum,i)
{

	for (i in array)
		sum=(sum)(sep)array[i]
	return sum
}

function _seq(string,cut,__varend__,out)
{
		gsub(cut," ",string)	
		"seq -s \" \" "string""|getline out
		close("seq -s \" \" "string"")
		gsub(/ +$/,"",out)
		return out
}

function _sub2array(s,array1,array2,__varend__,i)
{
		# CuxAu  a( 1 2 3 ...  )
		# _subarray("CuxAu","x",a)-----> a( Cu1Au Cu2Au Cu3Au ... )
		for(i in array1){array2[i]=gensub(s,array1[i],"",array2[i])}
		return 0
}

function _subarray(s,array,string,__varend__,i)
{
		# CuxAu  a( 1 2 3 ...  )
		# _subarray("CuxAu","x",a)-----> a( Cu1Au Cu2Au Cu3Au ... )
		for(i in array){array[i]=gensub(s,array[i],"",string)}
		return 0
}

function _size(Array,__varend__,count,i)
{
		#if(isarray(Array))
		{for(i in Array){count++}
		return count
		}
		#else{return 0}
}

function _appendArray(array0,array1,__varend__,size0,size1,i)
{
		size0=_size(array0)
		size1=_size(array1)
		for(i=1;i<=size0;i++ ){if(!(i in array0)){_message("e","function: +:_appendArray:- 1st array not continue for 0 to "size0" +R:STOP!:-");exit 1}}
		for(i=1;i<=size1;i++ ){if(!(i in array1)){_message("e","function: +:_appendArray:- 2ed array not continue for 0 to "size0" +R:STOP!:-");exit 1}}
		for(i=1;i<=size1;i++) { array0[i+size0]=array1[i]}
		return 0
}

function _sVecterAdd(ArrayA,ArrayB,ArrayC,check,__varend__,i,sizeA,sizeB)
{
		if(check)
		{
				sizeA=_size(ArrayA); sizeB=_size(ArrayB)
				if(sizeB!=sizeA)
				{_message("e","function _sVecterAdd: size of the 2 add arrays are not equal");return 1}
		}

		for(i in ArrayB)
		{
				if(! (i in ArrayA) && check)
				{_message("e","function _sVecterAdd: "i" in ArrayA but not in ArrayB");return 1}

				ArrayC[i]=ArrayA[i]ArrayB[i]
		}
		return 0
}



function _message(model,string,__varend__,color)
{
		if(model ~/\<[eE]rror\>|\<[eE]\>/)
		{
				color="+r:" ; gsub(/+:/,color,string)
				string="+wR:\007Error!:- "string":-"	
				print _colortext(string) > "/dev/stderr"
		}
		else if (model ~/\<[Dd]ebug\>|\<[Dd]\>/)
		{
				color="+c:" ; gsub(/+:/,color,string)
				string="+dC:Debug!:- "string":-"	
				print _colortext(string) > "/dev/stderr"
		}
		else if (model ~/\<[Mm]essage\>|\<[Mm]\>/)
		{
				color="+dG:" ; gsub(/+:/,color,string)
				string="+g: "string":-"	
				print _colortext(string) > "/dev/stderr"
		}
		else
		{ _message("e","in function +:_message:-: not exist the model:+:"model"") }

		#_message("Error","Today is +:Monday:-, Tomorrow is +:Suday:-. haha! ")
		#_message("d","Today is +:Monday:-, Tomorrow is +:Suday:-. haha! ")
		#_message("o","Today is +:Monday:-, Tomorrow is +:Suday:-. haha! ")
}

function _colortext(str,__varend__,i,j,SColor,AColor,replac,patten)
{
		str=gensub(/:-/,"\\\033[0m","g",str)

		SColor="u=4;d=30;r=31;g=32;y=33;b=34;m=35;c=36;w=37;F=7"
		SColor=SColor"D=40;R=41;G=42;Y=43;B=44;M=45;C=46;W=47"

		_dictionary(SColor,AColor,";","=")

		for(j=1;j<=3;j++)
		{
				for(i in AColor)
				{
						patten="+"i"([[:alpha:]]{,2}):"	
						replac="\\\033["AColor[i]"m+\\1:"	
						str=gensub(patten,replac,"g",str)

						if(str ~/.*\+:/ && str !~ /.*\+[[:alpha:]]{1,2}:.*/){break}
				}		
				if(str ~/.*\+:/ && str !~ /.*\+[[:alpha:]]{1,2}:.*/){break}
		}

		str=gensub(/\+:/,"","g",str)

		return str
}
function _X(str,times,__vend__,i,string)
{
		string=""
		for(i=1;i<=times;i++)
		{
				string=string""str
		}	

		return string		
}
#BEGIN{
	#str="1.6 -0.05 0"	
	#print _seq(str," ")	
	
	#str="1.6 -0.05 0"	
	#print _seq(str," ")	
		
	##str="ok"

	##close("awk '{printf \"%s \",$0}' "str"" |getline str)

	##print str


		
		
		#}
